app.use(static(process.cwd()))

app.use(async (ctx,next) => {
    let url = process.cwd();
    if(fs.existsSync(url)){
        //1.判断当前路径是否存在
        if(fs.statSync(url).isDirectory()){
            //2.判断当前路径是文件还是文件夹 是文件夹就返回true
            let list = fs.readdirSync(url);
            console.log(list);
            await ctx.render('index', {
                list,
                title:'hello'
            })
        }
    }
})


module.exports = app;